package com.example.samplegraphicstest;

import android.os.Bundle;
import android.app.Activity;
import android.graphics.Color;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {
	final static int GRAY = 1;
	final static int REVERSE = 2;	
	final static int SEPIA = 3;
	final static int BRIGHTNESS= 4;
	final static int CONTRAST= 5;
	MyView mView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mView = (MyView)findViewById(R.id.myView);
		Button btn = (Button)findViewById(R.id.gray);
		btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				mView.setImgProcessingMode(GRAY);
			}
		});
		btn = (Button)findViewById(R.id.reverse);
		btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				mView.setImgProcessingMode(REVERSE);
			}
		});
		btn = (Button)findViewById(R.id.sepia);
		btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				mView.setImgProcessingMode(SEPIA);
			}
		});
		btn = (Button)findViewById(R.id.bright);
		btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				mView.setImgProcessingMode(BRIGHTNESS);
			}
		});
		btn = (Button)findViewById(R.id.contrast);
		btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				mView.setImgProcessingMode(CONTRAST);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
